#define  _CRT_SECURE_NO_WARNINGS 1
using namespace std;
#include<iostream>
#include"reverse_iterator.h"
#include"list.h"
#include"vector.h"
void test_list1();
void test_list2();
void test_list3();
void test_list4();
int main()
{
	/*hlh::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);

	hlh::vector<int>::reverse_iterator rit = v.rbegin();
	while (rit != v.rend())
	{
		*rit += 5;
		cout << *rit << " ";
		++rit;
	}
	cout << endl;

	hlh::vector<int>::iterator it = v.begin();
	while (it != v.end())
	{
		*it -= 5;

		cout << *it << " ";
		++it;
	}
	cout << endl;*/
	test_list1();
	test_list2();
	test_list3();
	test_list4();

	return 0;
}
void test_list1()
{
	hlh::list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(4);

	hlh::list<int>::reverse_iterator it = lt.rbegin();
	while (it != lt.rend())
	{
		//*it += 10;

		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;
}

void test_list2()
{
	hlh::list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(4);


	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.push_back(5);
	lt.push_front(0);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.pop_back();
	lt.pop_front();

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.clear();

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	lt.push_back(10);
	lt.push_back(20);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;
}

void test_list3()
{
	hlh::list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(4);

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;

	hlh::list<int> copy(lt);
	for (auto e : copy)
	{
		cout << e << " ";
	}
	cout << endl;

	hlh::list<int> lt1;
	lt1.push_back(10);
	lt1.push_back(20);
	lt1.push_back(30);
	lt1.push_back(40);

	lt = lt1;
	for (auto e : copy)
	{
		cout << e << " ";
	}
	cout << endl;
}

void print_list(const hlh::list<int>& lt)
{
	hlh::list<int>::const_iterator it = lt.begin();
	while (it != lt.end())
	{
		//*it += 10;

		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (auto e : lt)
	{
		cout << e << " ";
	}
	cout << endl;
}

void test_list4()
{
	hlh::list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(4);

	print_list(lt);


	hlh::list<int>::iterator it = lt.begin();
	while (it != lt.end())
	{
		*it += 10;

		cout << *it << " ";
		++it;
	}
	cout << endl;
}
